package com.skyworth.ui.customview;

import android.content.Context;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;

/**
 * Created by luwei on 16-2-16.
 */
public class FocusHolder extends View implements View.OnKeyListener{
    public FocusHolder(Context context) {
        super(context);
    }

    public void enableFocus(){
        setFocusable(true);
        setFocusableInTouchMode(true);
    }

    public void disableFocus(){
        setFocusable(false);
        setFocusableInTouchMode(false);
    }


    public void shieldKey(){
        setOnKeyListener(this);
    }

    @Override
    public boolean onKey(View v, int keyCode, KeyEvent event) {
        Log.i("focusholder","current focus is focus holder");
        return true;
    }
}
